<?php
namespace Home\Controller;
use Think\Controller;
class XzController extends Controller {

    public function gr()
    {
        //自己
        $zj = M('gy_wuping')->field('gy_wuping.uid,gy_wuping.xm_id,t2.name,t2.face')->join('gy_user t2 ON gy_wuping.uid=t2.id')->where(['gy_wuping.uid'=>$_SESSION['id']])->find();
        $this->assign('zj',$zj);
        //个人
        $gr = M('gy_wuping')->field('gy_wuping.uid,gy_wuping.xm_id,gy_wuping.name,t2.face')->join('gy_user t2 ON gy_wuping.uid=t2.id')->where(['gy_wuping.fq_id<=1'])->select();
        $gr = second_array_unique_bykey($gr,'uid');
        //是自己就unset掉
        foreach ($gr as $k => $v) {
            if ($v['uid'] == $_SESSION['id']) {
               unset($gr[$k]);
            }
        }
        $this->assign('gr',$gr);

        $this->display();
    }

    public function xx()
    {
        //自己
        $zj = M('gy_faqi')->field('id,xm_id,school,imgs')->where(['fq_sf'=>2,'uid'=>$_SESSION['id']])->find();
        $this->assign('zj',$zj);
        //个人
        $xx = M('gy_faqi')->field('id,xm_id,school,imgs,uid')->where(['fq_sf=2'])->select();
        //是自己就unset掉
        foreach ($xx as $k => $v) {
            if ($v['uid'] == $_SESSION['id']) {
               unset($xx[$k]);
            }
        }
        $this->assign('xx',$xx);

        $this->display();
    }

    public function qy()
    {
        //自己
        $zj = M('gy_faqi')->field('id,xm_id,school,imgs')->where(['fq_sf'=>3,'uid'=>$_SESSION['id']])->find();
        $this->assign('zj',$zj);
        //个人
        $xx = M('gy_faqi')->field('id,xm_id,school,imgs,uid')->where(['fq_sf=3'])->select();
        //是自己就unset掉
        foreach ($xx as $k => $v) {
            if ($v['uid'] == $_SESSION['id']) {
               unset($xx[$k]);
            }
        }
        $this->assign('xx',$xx);

        $this->display();
    }

    public function cs()
    {
        //自己
        $zj = M('gy_faqi')->field('id,xm_id,school,imgs')->where(['fq_sf'=>4,'uid'=>$_SESSION['id']])->find();
        $this->assign('zj',$zj);
        //个人
        $xx = M('gy_faqi')->field('id,xm_id,school,imgs,uid')->where(['fq_sf=4'])->select();
        //是自己就unset掉
        foreach ($xx as $k => $v) {
            if ($v['uid'] == $_SESSION['id']) {
               unset($xx[$k]);
            }
        }
        $this->assign('xx',$xx);

        $this->display();
    }











}